import request from '@/utils/request'

export function findTreeList() {
    return request({
        url: '/goodsTypes/tree/list',
        method: 'get'
    })
}
export function findWaterList() {
    return request({
        url: '/goodsTypes/water/list',
        method: 'get'
    })
}

export function findList() {
    return request({
        url: '/goodsTypes',
        method: 'get'
    })
}

export function save(data) {
    if(data.id==null) {
        return request({
            url: '/goodsTypes',
            method: 'post',
            data: data,
        })
    }else{
        return request({
            url: '/goodsTypes/'+data.id,
            method: 'put',
            data: data,
        })
    }
}
export function findDetail(id) {
    return request({
        url: '/goodsTypes/'+id,
        method: 'get'
    })
}
export function deleted(id) {
    return request({
        url: '/goodsTypes/'+id,
        method: 'delete',
    })
}
export function changeStatus(id,status){
    return request({
        url: '/goodsTypes/changeStatus/'+id,
        method: 'put',
        params:{'status':status}
    })
}
export function changeSort(param){
    return request({
        url: '/goodsTypes/changeSort',
        method: 'put',
        params:param
    })
}